import pandas as pa
import os


class DataOpertaion:

    def __init__(self,path):
        self.data =pa.read_csv(path)

    #定义一个将数据转换为列表的方法
    def get_data_tolist(self):
        return self.data.values.tolist()

    def get_data_tolist1(self):

     # 定义一个将数据转换为字典的方法
    def get_data_todict(self):
        return [self.data.loc[i].to_dict() for i in self.data.index.values]




if __name__ == '__main__':
    a=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    # print(a)
    b =os.path.join(os.path.abspath(a),'data1','lj_data.csv')
    # print(b)
    do =DataOpertaion(b)
    print(do.get_data_todict())
    # print(do.get_data_tolist())








